Skip to content

🤖 fix: wait for successful template builds before promotion#70

Merged
ThomasK33 merged 3 commits into
mainfrom
k8s-operator-sa3j
Feb 13, 2026
Merged

🤖 fix: wait for successful template builds before promotion#70
ThomasK33 merged 3 commits into
mainfrom
k8s-operator-sa3j

Conversation

@ThomasK33
Copy link
Copy Markdown
Member

@ThomasK33 ThomasK33 commented Feb 13, 2026

Summary

Fix aggregated CoderTemplate update behavior so new template versions are promoted to active only after the build succeeds, and export a reusable aggregated template example for smoke/regression testing.

Background

Template updates were creating new Coder template versions, but promotion could race the provisioner build and fail with a "running build" error. That left active version unchanged, which matched the issue observed during testing.

Implementation

  • Added template build wait logic in aggregated template storage:
    • waits for template version job to reach "succeeded"
    • fails on "failed" / "canceled"
    • uses backoff polling with configurable env-based settings
  • Added/expanded tests in internal/aggregated/storage/storage_test.go:
    • coverage for pending-build wait before promotion
    • env configuration default/validation coverage
    • mock API behavior for build-state gated promotion
  • Added docs for tuning knobs in docs/how-to/deploy-aggregated-apiserver.md
  • Added reusable aggregated template example:
    • examples/aggregated/codertemplate-smoke-scratch.yaml
    • examples/aggregated/README.md
    • linked from root README.md

Validation

  • make verify-vendor
  • make test
  • make build
  • make lint
  • make docs-check
  • kubectl apply --dry-run=client -f examples/aggregated/codertemplate-smoke-scratch.yaml

Risks

  • Template update requests now block until build completes or timeout; this increases latency for update calls by design.
  • Misconfigured wait env vars now fail fast with explicit assertion errors (intentional defensive behavior).

Generated with mux • Model: openai:gpt-5.3-codex • Thinking: xhigh • Cost: $0.00

@ThomasK33
Copy link
Copy Markdown
Member Author

@codex review

Please review this PR for correctness and readiness.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cc356f5170

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/aggregated/storage/template.go Outdated
@ThomasK33
Copy link
Copy Markdown
Member Author

@codex review

Addressed feedback about preserving API error mapping for template build wait failures/timeouts.
Please re-review.

@ThomasK33
Copy link
Copy Markdown
Member Author

@codex review

Add configurable template-version build wait/backoff for aggregated codertemplate updates.
Export a reusable aggregated CoderTemplate example and document tuning knobs.
Preserve Kubernetes API error mapping for template build failures/timeouts during active-version promotion.
@ThomasK33
Copy link
Copy Markdown
Member Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b4629664eb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/aggregated/storage/template.go
Comment thread internal/aggregated/storage/template.go Outdated
@ThomasK33
Copy link
Copy Markdown
Member Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3fd9b30999

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/aggregated/storage/template.go
Address Codex review by aligning aggregated API request timeout defaults with template build waits and preserving timeout/cancel semantics when mapping build wait errors.

- set aggregated API request timeout default to 30m
- distinguish internal build wait expiry from request lifecycle cancellation/deadline
- keep internal wait expiry as BadRequest while returning Timeout for canceled/deadline contexts
- add coverage for request-timeout mapping and config defaults
- document request-timeout relationship in aggregated deployment guide

---

_Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$0.57`_

<!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=0.57 -->
@ThomasK33
Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ThomasK33 ThomasK33 added this pull request to the merge queue Feb 13, 2026
@ThomasK33
Copy link
Copy Markdown
Member Author

Merged via the queue into main with commit 21eb14d Feb 13, 2026
11 checks passed
@ThomasK33 ThomasK33 deleted the k8s-operator-sa3j branch February 13, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant